<html lang="en"><head>
    <meta charset="UTF-8">
    <title>git预览</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
    <link rel="stylesheet" href="./assets/argon.css">
    <style>
        body{
            margin: 0;
        }
    </style>
</head>
<body style="height: 100vh;">
<section class="section section-xl section-shaped pb-200" style="
    height: 100vh;
    vertical-align: middle;
">
    <div class="shape shape-style-1 shape-default" style="background: rgba(47, 85, 212);/* background: linear-gradient(180deg,#4277f8 0%,#5ebcfd 100%); */">
        <div style="width: 100%;height: 100%;position: absolute;opacity: 0.5;/* background: linear-gradient(180deg,#4277f8 0%,#5ebcfd 100%); */background-size: cover;left: 0;background-image: url(./assets/enterprise.jpg);"></div>
    </div>
    <div class="container py-lg-md d-flex">
        <div class="col px-0">
            <div class="row">
                <div class="col-lg-12 text-center">
                    <h1 class="display-2 text-white">Git预览
                        <!--<span>uTools 是什么？</span>-->
                    </h1>
                    <p class="text-white">已经支持了gitee、github。</p>
                    <p class="text-white">支持多种文件进行预览，已支持：视频、文本、图片等。</p>
                    <div class="btn-wrapper pt-3">
                        <input type="text" placeholder="请输入gitee/github文件地址进行预览" style="width: 60%;height: 40px;" onchange="changeUrl(event)">
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

<script>
    function changeUrl(event){
        let url = event.target.value;
        location.href = "./preview.html?" + url
    }

    //尝试从地址中获取
    let pattern = /.*?\/[?#](.*?)$/;
    let result = pattern.exec(location.href);
    if (result && result.length >= 2){
        location.href = "./preview.html?" + result[1]
    }
</script>

</body>
</html>
